
<div style="width:380px;height:60px;border: 1px solid #eee;text-align: center">
    <div style="margin-bottom: 3px">
        <span style="font-size: 16px">计算公式一</span>
    </div>
    <input class="easyui-numberbox" data-options="precision:3,prompt:'单价',onChange:freightCalculate" id="freightPrice"
           style="width: 40px">x
    <input class="easyui-numberbox"  data-options="precision:3,prompt:'重量',onChange:freightCalculate" id="freightWeight"
           style="width: 40px" >x
    <input class="easyui-numberbox" data-options="precision:3,prompt:'系数',onChange:freightCalculate" id="freightXiShu" style="width:50px">
</div>
 <div style="width:380px;height:60px;border: 1px solid #eee;text-align: center">
     <div style="margin-bottom: 3px">
         <span style="font-size: 16px">计算公式二</span>
     </div>
    <input id="freightPrice1" class="easyui-numberbox" data-options="precision:3,prompt:'单价',onChange:freightCalculate2"
           style="width: 40px">x
    <input id="freightWeight1" class="easyui-numberbox"  data-options="precision:3,prompt:'长',onChange:freightCalculate2"
           style="width: 40px" >x
    <input id="freightWidth" class="easyui-numberbox" data-options="precision:3,prompt:'宽',onChange:freightCalculate2" style="width:40px">x
    <input id="freightHeight" class="easyui-numberbox" data-options="precision:3,prompt:'高',onChange:freightCalculate2" style="width:40px">/1000000/
    <input id="freightPackingQuantity" class="easyui-numberbox" data-options="prompt:'装箱数量',onChange:freightCalculate2" style="width:40px">x
    <input id="freightXiShu1" class="easyui-numberbox" data-options="precision:3,prompt:'系数',onChange:freightCalculate2" style="width:40px">
</div>
<script>

    //计算公式一:运费计算方法
    function freightCalculate(newValue,oldValue){
        if (newValue){
            newValue=Number(newValue);
            var id=$(this).attr("id")
            var  freight=$("#freight");
            if(id=='freightWeight'){
                var freightPrice= Number($("#freightPrice").numberbox("getValue"));
                var freightXiShu= Number($("#freightXiShu").numberbox("getValue"));
                freight.numberbox("setValue",newValue *freightPrice * freightXiShu)
            }else if (id=='freightPrice') {
                var freightWeight=  Number($("#freightWeight").numberbox("getValue"));
                var freightXiShu=  Number($("#freightXiShu").numberbox("getValue"));
                freight.numberbox("setValue",newValue * freightWeight * freightXiShu)
            }else {
                var freightWeight=  Number($("#freightWeight").numberbox("getValue"));
                var freightPrice=  Number($("#freightPrice").numberbox("getValue"));
                freight.numberbox("setValue",newValue * freightWeight *freightPrice)
            }
        }
    }

    //计算公式二:运费计算方法   单价*长*宽*高/1000000/装箱数量*系数
    function freightCalculate2(newValue,oldValue){
        if (newValue){
            var id=$(this).attr("id")
            var  freight=$("#freight");
            if(id=='freightWeight1'){ //长
                var freightPrice=  Number($("#freightPrice1").numberbox("getValue"));  //单价
                var freightXiShu=  Number($("#freightXiShu1").numberbox("getValue"));   //系数
                var freightHeight=  Number($("#freightHeight").numberbox("getValue"));    //高
                var freightWidth=  Number($("#freightWidth").numberbox("getValue"));        //宽
                var freightPackingQuantity=  Number($("#freightPackingQuantity").numberbox("getValue"));        //装箱数量
                freight.numberbox("setValue",freightPrice * newValue * freightHeight * freightWidth /1000000/freightPackingQuantity * freightXiShu )
            }else if (id=='freightPrice1') {
                var freightWeight=  Number($("#freightWeight1").numberbox("getValue"));
                var freightXiShu=  Number($("#freightXiShu1").numberbox("getValue"));
                var freightHeight=  Number($("#freightHeight").numberbox("getValue"));
                var freightWidth=  Number($("#freightWidth").numberbox("getValue"));
                var freightPackingQuantity=  Number($("#freightPackingQuantity").numberbox("getValue"));        //装箱数量
                freight.numberbox("setValue",newValue * freightWeight * freightHeight * freightWidth /1000000/freightPackingQuantity * freightXiShu)
            }else if (id=='freightHeight'){
                var freightWeight=  Number($("#freightWeight1").numberbox("getValue"));
                var freightPrice=  Number($("#freightPrice1").numberbox("getValue"));
                var freightXiShu=  Number($("#freightXiShu1").numberbox("getValue"));
                var freightWidth=  Number($("#freightWidth").numberbox("getValue"));
                var freightPackingQuantity=  Number($("#freightPackingQuantity").numberbox("getValue"));        //装箱数量
                freight.numberbox("setValue",freightPrice * freightWeight * newValue * freightWidth /1000000/freightPackingQuantity * freightXiShu)
            }else if (id=='freightWidth'){
                var freightWeight=  Number($("#freightWeight1").numberbox("getValue"));
                var freightPrice=  Number($("#freightPrice1").numberbox("getValue"));
                var freightXiShu=  Number($("#freightXiShu1").numberbox("getValue"));
                var freightHeight=  Number($("#freightHeight").numberbox("getValue"));
                var freightPackingQuantity=  Number($("#freightPackingQuantity").numberbox("getValue"));        //装箱数量
                freight.numberbox("setValue",freightPrice * freightWeight * freightHeight * newValue /1000000/freightPackingQuantity * freightXiShu)
            }else if (id=='freightPackingQuantity'){
                var freightWeight= Number($("#freightWeight1").numberbox("getValue"));
                var freightPrice= Number($("#freightPrice1").numberbox("getValue"));
                var freightWidth= Number($("#freightWidth").numberbox("getValue"));
                var freightHeight= Number($("#freightHeight").numberbox("getValue"));
                var freightXiShu=  Number($("#freightXiShu1").numberbox("getValue"));
                freight.numberbox("setValue",freightPrice * freightWeight * freightHeight * freightWidth /1000000/newValue * freightXiShu)
            }else {
                var freightWeight= Number($("#freightWeight1").numberbox("getValue"));
                var freightPrice= Number($("#freightPrice1").numberbox("getValue"));
                var freightWidth= Number($("#freightWidth").numberbox("getValue"));
                var freightHeight= Number($("#freightHeight").numberbox("getValue"));
                var freightPackingQuantity=  Number($("#freightPackingQuantity").numberbox("getValue"));        //装箱数量
                freight.numberbox("setValue",freightPrice * freightWeight * freightHeight * freightWidth /1000000/freightPackingQuantity * newValue)
            }
        }
    }

</script>
